<%DIRECTIVE DYNAMIC;%>

<style type="text/css">
/* 图片上传样式 */
.weui_uploader_input {
	position: absolute;
	z-index: 2;
	top: 30px;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0)
}

.weui_uploader_input_wrp {
	float: left;
	position: relative;
	margin-left: 50px;
	width: 70%;
	height: 110px;
	border: 1px solid #d9d9d9
}

.weui_uploader_input_wrp:after, .weui_uploader_input_wrp:before {
	content: " ";
	position: absolute;
	top: 50%;
	left: 50%;
	-webkit-transform: translate(-50%, -50%);
	transform: translate(-50%, -50%);
	background-color: #d9d9d9
}

.weui_uploader_input_wrp:before {
	width: 2px;
	height: 39.5px
}

.weui_uploader_input_wrp:after {
	width: 39.5px;
	height: 2px
}

.weui_uploader_input_wrp:active {
	border-color: #999
}

.weui_uploader_input_wrp:active:after, .weui_uploader_input_wrp:active:before
	{
	background-color: #999
}
</style>

<div class="content-wrap">
	<div class="wrapper" style="min-height: 900px; min-width: 1000px;">
		<section class="panel panel-form">
			<header class="panel-heading clearfix brtl brtr">
				<div class="overflow-hidden">
					<a href="javascript:;" class="h4 show no-m pt5">${obj.temp_field.name!}</a>
				</div>
			</header>
			<form id="addForm" role="form" class="form-horizontal parsley-form"
				data-parsley-validate action="${base}/platform/field/editDo"
				method="post">
				<input type="hidden" name="id" value="${obj.temp_field.id!}">
				<input type="hidden" name="lng" value="${obj.temp_field.lng!}">
				<input type="hidden" name="lat" value="${obj.temp_field.lat!}">
				<input type="hidden" name="postcode"
					value="${obj.temp_field.postcode!}"> <input type="hidden"
					name="pcode" value="${obj.temp_field.pcode!}"> <input
					type="hidden" name="pname" value="${obj.temp_field.pname!}">
				<input type="hidden" name="citycode"
					value="${obj.temp_field.citycode!}"> <input type="hidden"
					name="cityname" value="${obj.temp_field.cityname!}"> <input
					type="hidden" name="adcode" value="${obj.temp_field.adcode!}">
				<input type="hidden" name="adname" value="${obj.temp_field.adname!}">
				<input type="hidden" name="deleteIds" id="deleteIds" value="">
				<div class="row mb10">
					<div class="col-lg-12">
						<div class="form-group">
							<label for="name" class="col-sm-2 control-label">名称</label>
							<div class="col-sm-8">
								<input type="text" id="name" value="${obj.temp_field.name!}"
									class="form-control" name="name" data-parsley-required="true"
									placeholder="名称">
							</div>
						</div>
						<div class="form-group">
							<label for="type" class="col-sm-2 control-label">类型</label>
							<div class="col-sm-8">
								<input type="text" id="type" class="form-control" name="type"
									data-parsley-required="true" placeholder="名称"
									value="${obj.temp_field.type!}">
							</div>
						</div>
						<div class="form-group">
							<label for="typecode" class="col-sm-2 control-label">类型编码</label>

							<div class="col-sm-8">
								<input type="text" id="typecode" name="typecode"
									value="${obj.temp_field.typecode!}"
									data-parsley-required="true" class="form-control"
									placeholder="类型编码">
							</div>
						</div>
						<div class="form-group">
							<label for="tel" class="col-sm-2 control-label">电话</label>

							<div class="col-sm-8">
								<input type="text" id="tel" name="tel"
									value="${obj.temp_field.tel!}" data-parsley-required="true"
									class="form-control" placeholder="电话">
							</div>
						</div>
						<div class="form-group">
							<label for="lnglat" class="col-sm-2 control-label">经纬度</label>

							<div class="col-sm-8">
								<input type="text" id="lnglat" readonly="readonly"
									value="${obj.temp_field.lng!},${obj.temp_field.lat!}"
									data-parsley-required="true" class="form-control"
									placeholder="经纬度">
							</div>
						</div>
						<div class="form-group">
							<label for="pca" class="col-sm-2 control-label">所属区域</label>

							<div class="col-sm-8">
								<input type="text" id="pca" readonly="readonly"
									value="${obj.temp_field.pname!} ${obj.temp_field.cityname!} ${obj.temp_field.adname!}"
									data-parsley-required="true" class="form-control"
									placeholder="所属区域">
							</div>
						</div>
						<div class="form-group">
							<label for="address" class="col-sm-2 control-label">地址</label>

							<div class="col-sm-8">
								<input type="text" id="address" name="address"
									value="${obj.temp_field.address!}" data-parsley-required="true"
									class="form-control" placeholder="地址">
							</div>
						</div>
					</div>
				</div>
				<div class="row mb12">
					<div style="clear:both;margin:10px 0;" id="photoDiv"  class="col-sm-10">
						<% if(null != obj.photo_list){ for(o in obj.photo_list){ if(null!=o.url ){%>
							<div style="margin-left: 150px;">
								<div style="float: left; width: 150px; height: 150px">
									<img style="width: 150px; height: 150px" alt="" src="${o.url!}" >
									<span style="position: relative; left: 123px; top:-145px; z-index: 10;">
										<img src="${base!}/assets/img/del.png" onclick="delold(this,'${o.id!}')" style="width:20px;height: 20px"/>
									</span>
								</div>
							</div>
						<%}}}%>
					</div>
					<div id="btnUpload" style="margin-left: 116px; margin-top: 8px;" >
						<div class="weui_uploader_input_wrp">
							<input id="one" type="file" class="weui_uploader_input accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
					<div
						style="margin-left: 250px; margin-right: 250px; position: relative;">
						<div class="form-group text-center">
							<label></label>
							<div>
								<button class="btn btn-primary btn-block btn-lg btn-parsley"
									data-loading-text="正在提交...">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</section>

	</div>
</div>
<script language="JavaScript">
	$(function() {
		upload();
	});
	//图片上传
	var i = 0;
	function upload() {
		$('#one').change(
		function() {
			i++;
			var file = this.files[0];
			var r = new FileReader();
			r.readAsDataURL(file);
			$(r).load(function() {
			var html = '<div style="margin-left: 150px;">'+
						'<div style="float: left; width: 150px; height: 150px">'
						+ '<input type="hidden" name="title['+i+']"  value=""  />'
						+ '<input type="hidden" name="url['+i+']" value="'+ this.result.replace(",", ".")+ '" />'
						+ '<img alt="" src="'+this.result +'" style="width: 150px; height: 150px" >'
						+ '<span style="position: relative; left: 123px; top:-145px; z-index: 10;">'
						+ '<img src="${base!}/assets/img/del.png" onclick="delold(this)" style="width:20px;height: 20px"/>'
						+ '</span></div></div>';
						$("#photoDiv").append(html);
			})
		})
	}
	//删除原有图片
	function delold(obj, id) {
		if (null != id) {
			var ids = $("#deleteIds").val();
			ids = ids + ";" + id;
			$("#deleteIds").val(ids);
		}
		jQuery(obj).parent().parent().remove();
	}
</script>

